package com.bwie.controller;

import com.bwie.common.domainThree.Contact;
import com.bwie.common.domainThree.Customer;
import com.bwie.common.domainThree.request.CustomerRequest;
import com.bwie.common.domainThree.request.FollowRequest;
import com.bwie.common.domainThree.response.CustomerResponse;
import com.bwie.common.result.Result;
import com.bwie.service.CustomerService;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @className: CustomerController
 * @Description: TODO
 * @version: v1.８.0
 * @author: 张雨乐
 */
@CrossOrigin
@RestController
public class CustomerController {
    @Autowired
    CustomerService customerService;

    @PostMapping("list")
    public Result list(@RequestBody CustomerRequest customerRequest){
        return customerService.list(customerRequest);
    }
    @GetMapping("contactList/{customerId}")
    public Result contactList(@PathVariable String customerId){
        return customerService.contactList(customerId);
    }
    @GetMapping("typeList/{id}")
    public Result typeList(@PathVariable String id){
        return customerService.typeList(id);
    }
    @PostMapping("contactAdd")
    public Result contactAdd(@RequestBody Contact contact){
        return customerService.contactAdd(contact);
    }
    @PostMapping("customerAdd")
    public Result customerAdd(@RequestBody Customer contact){
        return customerService.customerAdd(contact);
    }
    @GetMapping("getContact/{id}")
    public Result getContact(@PathVariable String id){
        return customerService.getContact(id);
    }
    @GetMapping("followList/{id}")
    public Result followList(@PathVariable String id){
        return customerService.followList(id);
    }
    @PostMapping("followAdd")
    public Result followAdd(@RequestBody FollowRequest followRequest){
        return customerService.followAdd(followRequest);
    }
    @PostMapping("customerDel")
    public Result customerDel(@RequestBody List<CustomerResponse> customerResponse){
        return customerService.customerDel(customerResponse);
    }

}
